﻿using MRGSP.SurveyMaster.Core.Model;
using MRGSP.SurveyMaster.Infra.ValueInjections;
using Omu.ValueInjecter;
using MRGSP.SurveyMaster.Infra.Dto;

namespace MRGSP.SurveyMaster.Infra
{
    public class UserCreateBuilder: IBuilder<User, UserCreateInput>
    {
        public UserCreateInput BuildInput(User entity)
        {
            var input = new UserCreateInput();
            input.InjectFrom(entity)
                .InjectFrom<ByteToLookup>(entity);
            return input;
        }

        public User BuildEntity(UserCreateInput input)
        {
            var o = new User();
            o.InjectFrom(input)
                .InjectFrom<LookupToByte>(input);
            return o;
        }

        public UserCreateInput RebuildInput(UserCreateInput input)
        {
            return BuildInput(BuildEntity(input));
        }
    }
}